package net.pinnoocle.config;

import com.baomidou.mybatisplus.extension.plugins.OptimisticLockerInterceptor;
import com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * mybatis-plus配置
 *
 * @author kokia
 * @date 2019-07-01 11:28
 * @since 1.0.0
 */
@Configuration
public class MybatisPlusConfig {


  /**
   * mybatis-plus分页插件.
   *
   * @Order的作用是定义Spring容器加载Bean的顺序
   */
  @Bean
  public PaginationInterceptor paginationInterceptor() {
    return new PaginationInterceptor();
  }

  /**
   * 启用性能分析插件
   * mybatis-plus SQL执行效率插件【生产环境可以关闭】
   */


  /**
   * 乐观锁插件
   */
  @Bean
  public OptimisticLockerInterceptor optimisticLockerInterceptor() {
    return new OptimisticLockerInterceptor();
  }


}
